package com.chen.admin.controller;


import com.chen.admin.common.Result;
import com.chen.admin.response.FinanceResponse;
import com.chen.admin.service.FinanceService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.ibatis.annotations.Param;
import org.omg.PortableInterceptor.INACTIVE;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@CrossOrigin(origins = "http://localhost:8080")
@RequestMapping("admin")
public class FinanceController {


    @Autowired
    private FinanceService financeService;

    /**
     * 统计销售额度
     */

    @GetMapping("/getFinanceAcount")
    public Result<PageInfo<FinanceResponse>> getFinanceAcount(@RequestParam(defaultValue = "1") Integer pageNumber,
                                                              @RequestParam(defaultValue = "10") Integer pageSize)
    {

        PageHelper.startPage(pageNumber,pageSize);
        List<FinanceResponse> financeAcount = financeService.getFinanceAcount();
        return Result.success(new PageInfo<>(financeAcount));
    }
}
